<?php

namespace catchAdmin\phone\request\userCompany;

use catcher\base\CatchRequest;

class saveRequest extends CatchRequest
{
    protected $needCreatorId = false;


    protected function rules(): array
    {
        $param = request()->param();

        $com_company = [
            'company_name|公司全称'     => 'require',
            'company_license|营业执照'  => 'require',
            'city_code|城市'            => 'require|array',
            'city_address|详细地址'     => 'require',
            'run_date|实际开始经营时间' => 'require|dateFormat:Y-m-d',
        ];

        $com_man = [
            'person_realname|负责人姓名' => 'require',
            'person_duty|负责人职务'     => 'require',
            'person_mobile|负责人手机号' => 'require|mobile',

            'linkman_realname|联系人姓名' => 'require',
            'linkman_duty|联系人职务'     => 'require',
            'linkman_mobile|联系人手机号' => 'require|mobile',
            'linkman_email|联系人邮箱'    => 'require|email',
        ];

        // 3=物资工厂
        if ($param['company_type'] == 3) {
            return array_merge($com_company, [
                'make_goods|生产产品' => 'require',
                'sale_goods|经销产品' => 'require',

                'dian_id|三大电网'    => 'require|array',
                'ji_tuan_id|五大六小' => 'require|array',
                'wai_mao_id|外贸业务' => 'require|array',

            ], $com_man);
            // 2=工程公司
        } elseif ($param['company_type'] == 2) {
            return array_merge($com_company, [
                'main_ye_wu|主营业务' => 'require',
                'zi_zhi|拥有资质'     => 'require|array',

                'dian_id|三大电网'    => 'require|array',
                'ji_tuan_id|五大六小' => 'require|array',
                'wai_mao_id|外贸业务' => 'require|array',
            ], $com_man);
            // 6=劳务公司
        } elseif ($param['company_type'] == 6) {
            return array_merge([
                'company_name|公司全称'     => 'require',
                'company_license|营业执照'  => 'require',
                'team_name|队伍全称'        => 'require',
                'city_code|城市'            => 'require',
                'city_address|详细地址'     => 'require',
                'run_date|实际开始经营时间' => 'require|dateFormat:Y-m-d',

                'main_ye_wu|主营业务' => 'require',
                'zi_zhi|拥有资质'     => 'require|array',

                'dian_id|三大电网'    => 'require|array',
                'ji_tuan_id|五大六小' => 'require|array',
                'wai_mao_id|外贸业务' => 'require|array',
            ], $com_man);
            // 4=设计公司
        } elseif ($param['company_type'] == 4) {
            return array_merge($com_company, [
                'main_ye_wu|主营业务' => 'require',
                'zi_zhi|拥有资质'     => 'require|array',

                'dian_id|三大电网'    => 'require|array',
                'ji_tuan_id|五大六小' => 'require|array',
                'wai_mao_id|外贸业务' => 'require|array',
            ], $com_man);
            // 5=监理公司
        } elseif ($param['company_type'] == 5) {
            return array_merge($com_company, [
                'main_ye_wu|主营业务' => 'require',
                'zi_zhi|拥有资质'     => 'require|array',

                'dian_id|三大电网'    => 'require|array',
                'ji_tuan_id|五大六小' => 'require|array',
                'wai_mao_id|外贸业务' => 'require|array',
            ], $com_man);
            // 7=贸易公司
        } elseif ($param['company_type'] == 7) {
            return array_merge($com_company, [
                'sale_goods|经销产品'    => 'require',
                'main_customer|主要客户' => 'require',
                'wai_mao_id|外贸业务'    => 'require|array',
            ], $com_man);
            // 8=行业协会
        } elseif ($param['company_type'] == 8) {
            return array_merge([
                'company_name|协会全称'    => 'require',
                'company_license|营业执照' => 'require',
                'city_code|城市'           => 'require',
                'city_address|详细地址'    => 'require',

                'zhu_guan_company|主管单位' => 'require',
                'register_date|成立时间'    => 'require|dateFormat:Y-m-d',
                'user_num|会员单位数量'     => 'require',
                'main_ye_wu|主要业务'       => 'require',
            ], $com_man);
        } else {
            return [];
        }
    }


    protected function message(): array
    {
        return [
//            'parent_id.require'    => '推广人不能为空',
//            'company_type.require' => '请选择公司类型',
//
//            'company_name.require'    => '请输入公司名',
//            'company_license.require' => '请上传营业执照',
//
//            'person_realname.require' => '请输入法人姓名',
//            'person_mobile.require'   => '请输入法人手机号',
//
//            'linkman_realname.require' => '请输入联系人姓名',
//            'linkman_mobile.require'   => '请输入联系人手机号',
//
//            'city_code.require'    => '请选择地区',
//            'city_address.require' => '请输入详细地址',
        ];
    }
}
